<template>
  <div class="common-layout" style="width: 100%">
        <el-container>
          <el-header style="padding:0;margin: 0;font-weight: bold;color: #fff;background-color: #4F8DFE;width: 100%">
            <div style="float: left;margin-top: 10px;font-size: 30px">
            CoolShark后台管理系统
            </div>
            <div style="float: right;margin-right: 50px">
              <el-dropdown style="margin-top: 15px;margin-left: 100px;">
                <el-button>
                  <el-icon><User /></el-icon>
                </el-button>
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item><el-button type="danger" @click="logoutuser">返回用户页面</el-button></el-dropdown-item>
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </div>
          </el-header>
          <el-container>
            <el-aside width="200px" >
              <el-menu mode="vertical" background-color="#fff" text-color="#000"
                                             active-text-color="#ff0" default-active="4" @select="handleSelect" router style="height: 100vh"index="1">
                  <template #title><span>轮播图管理</span></template>
                  <el-menu-item index="pict">轮播图列表</el-menu-item>
                  <el-menu-item index="pictAdd">添加轮播图</el-menu-item>
                <el-sub-menu index="2">
                  <template #title><span>商品管理</span></template>
                  <el-menu-item index="listAdd">商品列表</el-menu-item>
                  <el-menu-item index="/adminAdd">添加商品</el-menu-item>
                </el-sub-menu>
            </el-menu>
            </el-aside>
            <el-main style="padding:20px 0;overflow: hidden; margin-top: -19px">
              <router-view/>
            </el-main>
          </el-container>
    </el-container>
  </div>
</template>

<script setup>
import {ref} from "vue";

const logoutuser =()=>{
  if(confirm('您确认要退出登录吗?')){
    //退出时要:清空本地存储+跳转至登录页+清除已取出的用户数据
    // localStorage.removeItem('user');
    window.location.href = 'http://localhost:9092/user';
  }
}


</script>

<style scoped>

</style>